package ModelLayer;
import java.util.ArrayList;
import java.util.Iterator;


public class AddressBook
{
    public ArrayList<Person> friends;

    /* Constructor for class AddressBook */
    public AddressBook()
    {
        friends = new ArrayList<Person>();
    }
    
    /* Function for adding a person */
    public void addPerson(Person person)
    {
        friends.add(person);
    }
    
    /*Print method for all presons */
    public void print()
    {
        for(Person person : friends) {  
           person.printDetails();
        }           
    }
    
    /* Function for creating a person if it's not in the system */
    public void createPerson(long id, String name, String address, String postalCode, String city, String phone)
    {
        Person people = new Person(id, name, address, postalCode, city, phone);
            if(friends.contains(people)) {
                System.out.println("Person already in the addressbook");
            }
            else { 
                friends.add(people);
            }
    
    }
    
}